'use strict';
//求租
const Controller = require('egg').Controller;

class BuyController extends Controller {
    async index() {
        const {
            ctx
        } = this;
        ctx.body = 'hi, egg';
    }

    async gebuythouse() {
        const {
            ctx
        } = this;
        const data = await this.app.mysql.select('buyhouse');
        ctx.body = data;
    }

    async getBuyType() {
        const {
            ctx
        } = this;
        const {
            val
        } = ctx.query;
        const data = await this.app.mysql.select('buyhouse', {
            where: {
                type: val
            }
        });
        ctx.body = data;
    }

    async getBuyArea() {

        const {
            ctx
        } = this;
        const {
            val
        } = ctx.query;

        const data = await this.app.mysql.select('buyhouse', {
            where: {
                area: val
            }
        });
        ctx.body = data;
    }

}

module.exports = BuyController;